# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2025/3/1
desc: 
sample: 
"""
print('1111')
name='testfan'
print(name[0])
print(name[-1])

#左开右闭
print(name[2:5]) #s..a

data_list = ['极光', 'zhangsan', '李四', 'mtx', '王五']
print(data_list[0:2])
print(data_list[1:])
print(data_list[::-1])

#1,10
for item in range(1,11):
    print(item,end='_')

#10..1
print('-----')
for item in range(10,0,-1):
    print(item,end='_')

print()
#负数 步长 默认步长+1 升序规则 从小到大
print(name[-5:-2]) #s..a  stf
print("--步长为负数")
# 步长-1 降序规则
print(name[-2:-5:-1]) #a。。s tfa

name='testfan'
#左开右闭
#当缺省时，默认起始或者结尾
print(name[:5]) #t..a testf
print(name[5:]) #an #默认结尾时候不参与闭合
print(name[:-2]) #t..a testf
print(name[-2:]) #an

print(name[::-1])